const app = getApp();
import { request } from '../../utils/request'
import config from '../../utils/config'
Page({
    data: {
        custom: wx.getMenuButtonBoundingClientRect(),
        userInfo: {},
        page: 1,
        last_page: 1,
        list: [],
        endHide: true
    },
    onLoad(options) {
        wx.hideShareMenu()
        
    },
    onShow(){
        // console.log('onshow in wallet page')
        this.setData({ userInfo: wx.getStorageSync('userInfo') })
        this.getList()
    },
    onReachBottom() {
        if (this.data.page >= this.data.last_page) {
            this.setData({ endHide: false })
            return false;
        }
        this.setData({ page: this.data.page + 1 })
        this.getList()
    },
    getList() {
        request({
            url: "/miniprogram/user/getJournalList",
            data: { page: this.data.page, user_id: this.data.userInfo.id },
            type: 'post'
        }).then(res => {
            if (this.data.page == 1) {
                this.setData({ list: [] })
            }
            this.setData({
                list: this.data.list.concat(res.data),
                last_page: res.last_page
            })
        })
    }
})